package main
import "fmt"
import "sync"
import "time"

var wg sync.WaitGroup

func test(num int) {
	defer wg.Done()
	for i:=0; i<=10; i++ {
		fmt.Printf("协程 %v 打印第 %v 条数据\n", num, i)
		time.Sleep(time.Millisecond * 500)
	}
}

func main() {
	for i:=0; i<=10; i++ {
		wg.Add(1)
		go test(i)
	}
	wg.Wait()
}